This is an R Markdown Notebook. When you execute code within the notebook, the results appear beneath the code.

Load the required libraries. If you don’t have them installed, please do by running install.packages()

library(plotly)
Le chargement a nécessité le package : ggplot2
Learn more about the underlying theory at https://ggplot2-book.org/
Registered S3 method overwritten by 'data.table':
  method           from
  print.data.table     
Registered S3 method overwritten by 'htmlwidgets':
  method           from         
  print.htmlwidget tools:rstudio

Attachement du package : ‘plotly’

The following object is masked from ‘package:ggplot2’:

    last_plot

The following object is masked from ‘package:stats’:

    filter

The following object is masked from ‘package:graphics’:

    layout
library(stringr)
library(reshape2)
library(dplyr)

Attachement du package : ‘dplyr’

The following objects are masked from ‘package:stats’:

    filter, lag

The following objects are masked from ‘package:base’:

    intersect, setdiff, setequal, union
library(readr)

Load the NMR binned csv. Just adapt the path to location of your file. You can use autocompletion using the tab key

Binning_Fusarium_sh1 <- read_csv("../../data/Binning_Fusarium_matz_center_named.csv")

── Column specification ───────────────────────────────────────────────────────────────────────────────────────────────────────
cols(
  .default = col_double()
)
ℹ Use `spec()` for the full column specifications.

Lets have a look at the first rows of this file

head(Binning_Fusarium_sh1)

OK. Be sure to have ppm on the columns and fraction numbers as rows. Now we transform the dataframe as a matrix

DTz <- as.matrix(data.frame(Binning_Fusarium_sh1))

Lets have a look at the structure of the file

str(DTz)
 num [1:135, 1:1603] 1 2 3 4 5 6 7 8 9 10 ...
 - attr(*, "dimnames")=List of 2
  ..$ : NULL
  ..$ : chr [1:1603] "X." "X.1.00831" "X.0.998305" "X.0.988305" ...

Now we’ll remove the row indexes

DTz <- DTz[,-1] 

And we set the matrix row and colnames according to the ones of the df

colnames(DTz) <- colnames(Binning_Fusarium_sh1)[-1]
rownames(DTz) <- rownames(Binning_Fusarium_sh1)

Let’s transform these data in the long form


mtrx.melt <- melt(DTz, id.vars = c('sample', 'ppm'), measure.vars = 'int')
names(mtrx.melt) <- c('sample', 'ppm', 'int')

Now we can plot a quick 3Dplot to have an overview of the data


p <- plot_ly(z = ~DTz) %>% add_surface()

p

OK so now we want to remove the annoying signals corresponding to the solvents. We can check at the colunms name and note their numbers. Example its DMSO > signals at 2.5 ppm I want to delete columns 350,351 and 352.


colnames(DTz)
   [1] "-1.00831"    "-0.998305"   "-0.988305"   "-0.978304"   "-0.968304"   "-0.958303"   "-0.948303"   "-0.938302"  
   [9] "-0.928302"   "-0.918301"   "-0.9083"     "-0.8983"     "-0.888299"   "-0.878299"   "-0.868298"   "-0.858298"  
  [17] "-0.848297"   "-0.838297"   "-0.828296"   "-0.818296"   "-0.808295"   "-0.798295"   "-0.788294"   "-0.778294"  
  [25] "-0.768293"   "-0.758292"   "-0.748292"   "-0.738291"   "-0.728291"   "-0.71829"    "-0.70829"    "-0.698289"  
  [33] "-0.688289"   "-0.678288"   "-0.668288"   "-0.658287"   "-0.648287"   "-0.638286"   "-0.628285"   "-0.618285"  
  [41] "-0.608284"   "-0.598284"   "-0.588283"   "-0.578283"   "-0.568282"   "-0.558282"   "-0.548281"   "-0.538281"  
  [49] "-0.52828"    "-0.51828"    "-0.508279"   "-0.498279"   "-0.488278"   "-0.478277"   "-0.468277"   "-0.458276"  
  [57] "-0.448276"   "-0.438275"   "-0.428275"   "-0.418274"   "-0.408274"   "-0.398273"   "-0.388273"   "-0.378272"  
  [65] "-0.368272"   "-0.358271"   "-0.348271"   "-0.33827"    "-0.328269"   "-0.318269"   "-0.308268"   "-0.298268"  
  [73] "-0.288267"   "-0.278267"   "-0.268266"   "-0.258266"   "-0.248265"   "-0.238265"   "-0.228264"   "-0.218264"  
  [81] "-0.208263"   "-0.198262"   "-0.188262"   "-0.178261"   "-0.168261"   "-0.15826"    "-0.14826"    "-0.138259"  
  [89] "-0.128259"   "-0.118258"   "-0.108258"   "-0.0982571"  "-0.0882566"  "-0.0782561"  "-0.0682555"  "-0.058255"  
  [97] "-0.0482545"  "-0.0382539"  "-0.0282534"  "-0.0182529"  "-0.00825233" "0.00174821"  "0.0117487"   "0.0217493"  
 [105] "0.0317498"   "0.0417503"   "0.0517509"   "0.0617514"   "0.071752"    "0.0817525"   "0.091753"    "0.101754"   
 [113] "0.111754"    "0.121755"    "0.131755"    "0.141756"    "0.151756"    "0.161757"    "0.171757"    "0.181758"   
 [121] "0.191758"    "0.201759"    "0.211759"    "0.22176"     "0.231761"    "0.241761"    "0.251762"    "0.261762"   
 [129] "0.271763"    "0.281763"    "0.291764"    "0.301764"    "0.311765"    "0.321765"    "0.331766"    "0.341766"   
 [137] "0.351767"    "0.361767"    "0.371768"    "0.381769"    "0.391769"    "0.40177"     "0.41177"     "0.421771"   
 [145] "0.431771"    "0.441772"    "0.451772"    "0.461773"    "0.471773"    "0.481774"    "0.491774"    "0.501775"   
 [153] "0.511775"    "0.521776"    "0.531777"    "0.541777"    "0.551778"    "0.561778"    "0.571779"    "0.581779"   
 [161] "0.59178"     "0.60178"     "0.611781"    "0.621781"    "0.631782"    "0.641782"    "0.651783"    "0.661784"   
 [169] "0.671784"    "0.681785"    "0.691785"    "0.701786"    "0.711786"    "0.721787"    "0.731787"    "0.741788"   
 [177] "0.751788"    "0.761789"    "0.771789"    "0.78179"     "0.79179"     "0.801791"    "0.811792"    "0.821792"   
 [185] "0.831793"    "0.841793"    "0.851794"    "0.861794"    "0.871795"    "0.881795"    "0.891796"    "0.901796"   
 [193] "0.911797"    "0.921797"    "0.931798"    "0.941799"    "0.951799"    "0.9618"      "0.9718"      "0.981801"   
 [201] "0.991801"    "1.0018"      "1.0118"      "1.0218"      "1.0318"      "1.0418"      "1.0518"      "1.0618"     
 [209] "1.07181"     "1.08181"     "1.09181"     "1.10181"     "1.11181"     "1.12181"     "1.13181"     "1.14181"    
 [217] "1.15181"     "1.16181"     "1.17181"     "1.18181"     "1.19181"     "1.20181"     "1.21181"     "1.22181"    
 [225] "1.23181"     "1.24181"     "1.25182"     "1.26182"     "1.27182"     "1.28182"     "1.29182"     "1.30182"    
 [233] "1.31182"     "1.32182"     "1.33182"     "1.34182"     "1.35182"     "1.36182"     "1.37182"     "1.38182"    
 [241] "1.39182"     "1.40182"     "1.41182"     "1.42182"     "1.43182"     "1.44183"     "1.45183"     "1.46183"    
 [249] "1.47183"     "1.48183"     "1.49183"     "1.50183"     "1.51183"     "1.52183"     "1.53183"     "1.54183"    
 [257] "1.55183"     "1.56183"     "1.57183"     "1.58183"     "1.59183"     "1.60183"     "1.61183"     "1.62183"    
 [265] "1.63184"     "1.64184"     "1.65184"     "1.66184"     "1.67184"     "1.68184"     "1.69184"     "1.70184"    
 [273] "1.71184"     "1.72184"     "1.73184"     "1.74184"     "1.75184"     "1.76184"     "1.77184"     "1.78184"    
 [281] "1.79184"     "1.80184"     "1.81185"     "1.82185"     "1.83185"     "1.84185"     "1.85185"     "1.86185"    
 [289] "1.87185"     "1.88185"     "1.89185"     "1.90185"     "1.91185"     "1.92185"     "1.93185"     "1.94185"    
 [297] "1.95185"     "1.96185"     "1.97185"     "1.98185"     "1.99185"     "2.00186"     "2.01186"     "2.02186"    
 [305] "2.03186"     "2.04186"     "2.05186"     "2.06186"     "2.07186"     "2.08186"     "2.09186"     "2.10186"    
 [313] "2.11186"     "2.12186"     "2.13186"     "2.14186"     "2.15186"     "2.16186"     "2.17186"     "2.18186"    
 [321] "2.19187"     "2.20187"     "2.21187"     "2.22187"     "2.23187"     "2.24187"     "2.25187"     "2.26187"    
 [329] "2.27187"     "2.28187"     "2.29187"     "2.30187"     "2.31187"     "2.32187"     "2.33187"     "2.34187"    
 [337] "2.35187"     "2.36187"     "2.37188"     "2.38188"     "2.39188"     "2.40188"     "2.41188"     "2.42188"    
 [345] "2.43188"     "2.44188"     "2.45188"     "2.46188"     "2.47188"     "2.48188"     "2.49188"     "2.50188"    
 [353] "2.51188"     "2.52188"     "2.53188"     "2.54188"     "2.55188"     "2.56189"     "2.57189"     "2.58189"    
 [361] "2.59189"     "2.60189"     "2.61189"     "2.62189"     "2.63189"     "2.64189"     "2.65189"     "2.66189"    
 [369] "2.67189"     "2.68189"     "2.69189"     "2.70189"     "2.71189"     "2.72189"     "2.73189"     "2.74189"    
 [377] "2.7519"      "2.7619"      "2.7719"      "2.7819"      "2.7919"      "2.8019"      "2.8119"      "2.8219"     
 [385] "2.8319"      "2.8419"      "2.8519"      "2.8619"      "2.8719"      "2.8819"      "2.8919"      "2.9019"     
 [393] "2.9119"      "2.9219"      "2.9319"      "2.94191"     "2.95191"     "2.96191"     "2.97191"     "2.98191"    
 [401] "2.99191"     "3.00191"     "3.01191"     "3.02191"     "3.03191"     "3.04191"     "3.05191"     "3.06191"    
 [409] "3.07191"     "3.08191"     "3.09191"     "3.10191"     "3.11191"     "3.12192"     "3.13192"     "3.14192"    
 [417] "3.15192"     "3.16192"     "3.17192"     "3.18192"     "3.19192"     "3.20192"     "3.21192"     "3.22192"    
 [425] "3.23192"     "3.24192"     "3.25192"     "3.26192"     "3.27192"     "3.28192"     "3.29192"     "3.30192"    
 [433] "3.31193"     "3.32193"     "3.33193"     "3.34193"     "3.35193"     "3.36193"     "3.37193"     "3.38193"    
 [441] "3.39193"     "3.40193"     "3.41193"     "3.42193"     "3.43193"     "3.44193"     "3.45193"     "3.46193"    
 [449] "3.47193"     "3.48193"     "3.49193"     "3.50194"     "3.51194"     "3.52194"     "3.53194"     "3.54194"    
 [457] "3.55194"     "3.56194"     "3.57194"     "3.58194"     "3.59194"     "3.60194"     "3.61194"     "3.62194"    
 [465] "3.63194"     "3.64194"     "3.65194"     "3.66194"     "3.67194"     "3.68195"     "3.69195"     "3.70195"    
 [473] "3.71195"     "3.72195"     "3.73195"     "3.74195"     "3.75195"     "3.76195"     "3.77195"     "3.78195"    
 [481] "3.79195"     "3.80195"     "3.81195"     "3.82195"     "3.83195"     "3.84195"     "3.85195"     "3.86195"    
 [489] "3.87196"     "3.88196"     "3.89196"     "3.90196"     "3.91196"     "3.92196"     "3.93196"     "3.94196"    
 [497] "3.95196"     "3.96196"     "3.97196"     "3.98196"     "3.99196"     "4.00196"     "4.01196"     "4.02196"    
 [505] "4.03196"     "4.04196"     "4.05196"     "4.06197"     "4.07197"     "4.08197"     "4.09197"     "4.10197"    
 [513] "4.11197"     "4.12197"     "4.13197"     "4.14197"     "4.15197"     "4.16197"     "4.17197"     "4.18197"    
 [521] "4.19197"     "4.20197"     "4.21197"     "4.22197"     "4.23197"     "4.24198"     "4.25198"     "4.26198"    
 [529] "4.27198"     "4.28198"     "4.29198"     "4.30198"     "4.31198"     "4.32198"     "4.33198"     "4.34198"    
 [537] "4.35198"     "4.36198"     "4.37198"     "4.38198"     "4.39198"     "4.40198"     "4.41198"     "4.42198"    
 [545] "4.43199"     "4.44199"     "4.45199"     "4.46199"     "4.47199"     "4.48199"     "4.49199"     "4.50199"    
 [553] "4.51199"     "4.52199"     "4.53199"     "4.54199"     "4.55199"     "4.56199"     "4.57199"     "4.58199"    
 [561] "4.59199"     "4.60199"     "4.61199"     "4.622"       "4.632"       "4.642"       "4.652"       "4.662"      
 [569] "4.672"       "4.682"       "4.692"       "4.702"       "4.712"       "4.722"       "4.732"       "4.742"      
 [577] "4.752"       "4.762"       "4.772"       "4.782"       "4.792"       "4.80201"     "4.81201"     "4.82201"    
 [585] "4.83201"     "4.84201"     "4.85201"     "4.86201"     "4.87201"     "4.88201"     "4.89201"     "4.90201"    
 [593] "4.91201"     "4.92201"     "4.93201"     "4.94201"     "4.95201"     "4.96201"     "4.97201"     "4.98201"    
 [601] "4.99202"     "5.00202"     "5.01202"     "5.02202"     "5.03202"     "5.04202"     "5.05202"     "5.06202"    
 [609] "5.07202"     "5.08202"     "5.09202"     "5.10202"     "5.11202"     "5.12202"     "5.13202"     "5.14202"    
 [617] "5.15202"     "5.16202"     "5.17202"     "5.18203"     "5.19203"     "5.20203"     "5.21203"     "5.22203"    
 [625] "5.23203"     "5.24203"     "5.25203"     "5.26203"     "5.27203"     "5.28203"     "5.29203"     "5.30203"    
 [633] "5.31203"     "5.32203"     "5.33203"     "5.34203"     "5.35203"     "5.36203"     "5.37204"     "5.38204"    
 [641] "5.39204"     "5.40204"     "5.41204"     "5.42204"     "5.43204"     "5.44204"     "5.45204"     "5.46204"    
 [649] "5.47204"     "5.48204"     "5.49204"     "5.50204"     "5.51204"     "5.52204"     "5.53204"     "5.54204"    
 [657] "5.55205"     "5.56205"     "5.57205"     "5.58205"     "5.59205"     "5.60205"     "5.61205"     "5.62205"    
 [665] "5.63205"     "5.64205"     "5.65205"     "5.66205"     "5.67205"     "5.68205"     "5.69205"     "5.70205"    
 [673] "5.71205"     "5.72205"     "5.73205"     "5.74206"     "5.75206"     "5.76206"     "5.77206"     "5.78206"    
 [681] "5.79206"     "5.80206"     "5.81206"     "5.82206"     "5.83206"     "5.84206"     "5.85206"     "5.86206"    
 [689] "5.87206"     "5.88206"     "5.89206"     "5.90206"     "5.91206"     "5.92206"     "5.93207"     "5.94207"    
 [697] "5.95207"     "5.96207"     "5.97207"     "5.98207"     "5.99207"     "6.00207"     "6.01207"     "6.02207"    
 [705] "6.03207"     "6.04207"     "6.05207"     "6.06207"     "6.07207"     "6.08207"     "6.09207"     "6.10207"    
 [713] "6.11208"     "6.12208"     "6.13208"     "6.14208"     "6.15208"     "6.16208"     "6.17208"     "6.18208"    
 [721] "6.19208"     "6.20208"     "6.21208"     "6.22208"     "6.23208"     "6.24208"     "6.25208"     "6.26208"    
 [729] "6.27208"     "6.28208"     "6.29208"     "6.30209"     "6.31209"     "6.32209"     "6.33209"     "6.34209"    
 [737] "6.35209"     "6.36209"     "6.37209"     "6.38209"     "6.39209"     "6.40209"     "6.41209"     "6.42209"    
 [745] "6.43209"     "6.44209"     "6.45209"     "6.46209"     "6.47209"     "6.48209"     "6.4921"      "6.5021"     
 [753] "6.5121"      "6.5221"      "6.5321"      "6.5421"      "6.5521"      "6.5621"      "6.5721"      "6.5821"     
 [761] "6.5921"      "6.6021"      "6.6121"      "6.6221"      "6.6321"      "6.6421"      "6.6521"      "6.6621"     
 [769] "6.67211"     "6.68211"     "6.69211"     "6.70211"     "6.71211"     "6.72211"     "6.73211"     "6.74211"    
 [777] "6.75211"     "6.76211"     "6.77211"     "6.78211"     "6.79211"     "6.80211"     "6.81211"     "6.82211"    
 [785] "6.83211"     "6.84211"     "6.85211"     "6.86212"     "6.87212"     "6.88212"     "6.89212"     "6.90212"    
 [793] "6.91212"     "6.92212"     "6.93212"     "6.94212"     "6.95212"     "6.96212"     "6.97212"     "6.98212"    
 [801] "6.99212"     "7.00212"     "7.01212"     "7.02212"     "7.03212"     "7.04212"     "7.05213"     "7.06213"    
 [809] "7.07213"     "7.08213"     "7.09213"     "7.10213"     "7.11213"     "7.12213"     "7.13213"     "7.14213"    
 [817] "7.15213"     "7.16213"     "7.17213"     "7.18213"     "7.19213"     "7.20213"     "7.21213"     "7.22213"    
 [825] "7.23214"     "7.24214"     "7.25214"     "7.26214"     "7.27214"     "7.28214"     "7.29214"     "7.30214"    
 [833] "7.31214"     "7.32214"     "7.33214"     "7.34214"     "7.35214"     "7.36214"     "7.37214"     "7.38214"    
 [841] "7.39214"     "7.40214"     "7.41214"     "7.42215"     "7.43215"     "7.44215"     "7.45215"     "7.46215"    
 [849] "7.47215"     "7.48215"     "7.49215"     "7.50215"     "7.51215"     "7.52215"     "7.53215"     "7.54215"    
 [857] "7.55215"     "7.56215"     "7.57215"     "7.58215"     "7.59215"     "7.60215"     "7.61216"     "7.62216"    
 [865] "7.63216"     "7.64216"     "7.65216"     "7.66216"     "7.67216"     "7.68216"     "7.69216"     "7.70216"    
 [873] "7.71216"     "7.72216"     "7.73216"     "7.74216"     "7.75216"     "7.76216"     "7.77216"     "7.78216"    
 [881] "7.79216"     "7.80217"     "7.81217"     "7.82217"     "7.83217"     "7.84217"     "7.85217"     "7.86217"    
 [889] "7.87217"     "7.88217"     "7.89217"     "7.90217"     "7.91217"     "7.92217"     "7.93217"     "7.94217"    
 [897] "7.95217"     "7.96217"     "7.97217"     "7.98218"     "7.99218"     "8.00218"     "8.01218"     "8.02218"    
 [905] "8.03218"     "8.04218"     "8.05218"     "8.06218"     "8.07218"     "8.08218"     "8.09218"     "8.10218"    
 [913] "8.11218"     "8.12218"     "8.13218"     "8.14218"     "8.15218"     "8.16218"     "8.17219"     "8.18219"    
 [921] "8.19219"     "8.20219"     "8.21219"     "8.22219"     "8.23219"     "8.24219"     "8.25219"     "8.26219"    
 [929] "8.27219"     "8.28219"     "8.29219"     "8.30219"     "8.31219"     "8.32219"     "8.33219"     "8.34219"    
 [937] "8.35219"     "8.3622"      "8.3722"      "8.3822"      "8.3922"      "8.4022"      "8.4122"      "8.4222"     
 [945] "8.4322"      "8.4422"      "8.4522"      "8.4622"      "8.4722"      "8.4822"      "8.4922"      "8.5022"     
 [953] "8.5122"      "8.5222"      "8.5322"      "8.54221"     "8.55221"     "8.56221"     "8.57221"     "8.58221"    
 [961] "8.59221"     "8.60221"     "8.61221"     "8.62221"     "8.63221"     "8.64221"     "8.65221"     "8.66221"    
 [969] "8.67221"     "8.68221"     "8.69221"     "8.70221"     "8.71221"     "8.72221"     "8.73222"     "8.74222"    
 [977] "8.75222"     "8.76222"     "8.77222"     "8.78222"     "8.79222"     "8.80222"     "8.81222"     "8.82222"    
 [985] "8.83222"     "8.84222"     "8.85222"     "8.86222"     "8.87222"     "8.88222"     "8.89222"     "8.90222"    
 [993] "8.91222"     "8.92223"     "8.93223"     "8.94223"     "8.95223"     "8.96223"     "8.97223"     "8.98223"    
 [ reached getOption("max.print") -- omitted 602 entries ]

DTzred <- DTz[,-348:-352]

Now lets plot again …. Does it looks better ?

p <- plot_ly(z = ~DTzred) %>% add_surface()

p

Else repeat the previous step For this execute the following code. Be sure to run it on the previously cleaned object. In this case DTzred Be sure to check again the columns numbers sinsce these have changed

colnames(DTzred)
DTzred <- DTzred[,-348:-352]

Now that you have the cleaned data object lets have a look at the 2d map. Be patient, this one is longer to plot.

p <- plot_ly(mtrx.melt, x = ~sample, y = ~ppm, z = ~int, type = "contour",
             colors = 'YlOrRd',
             autocontour = F,
             contours = list(
               start = 10000,
               end = 1200000,
               size = 5000
             )
            )

p
NA

If you want to plot the map with ppm on the x-axis just reverse the axis order. Play with start value (to fix the noise) and size value to fix the contour space. Change color if you wish by changing the color field. For more info on 2d contour plot with plotly check https://plot.ly/r/contour-plots/


p <- plot_ly(mtrx.melt, x = ~ppm, y = ~sample, z = ~int, type = "contour",
             autocontour = F,
             colors = 'YlOrRd',
             contours = list(
               start = 10000,
               end = 1200000,
               size = 50000
             )
            ) %>% layout(xaxis = list(autorange = "reversed"))

p
NA

When you save the notebook, an HTML file containing the code and output will be saved alongside it (click the Preview button or press Cmd+Shift+K to preview the HTML file).

The preview shows you a rendered HTML copy of the contents of the editor. Consequently, unlike Knit, Preview does not run any R code chunks. Instead, the output of the chunk when it was last run in the editor is displayed.

LS0tCnRpdGxlOiAiTk1SIERhdGEgcGxvdHRlciIKb3V0cHV0OgogIGh0bWxfZG9jdW1lbnQ6CiAgICBkZl9wcmludDogcGFnZWQKICBodG1sX25vdGVib29rOiBkZWZhdWx0CiAgcGRmX2RvY3VtZW50OiBkZWZhdWx0Ci0tLQoKVGhpcyBpcyBhbiBbUiBNYXJrZG93bl0oaHR0cDovL3JtYXJrZG93bi5yc3R1ZGlvLmNvbSkgTm90ZWJvb2suIFdoZW4geW91IGV4ZWN1dGUgY29kZSB3aXRoaW4gdGhlIG5vdGVib29rLCB0aGUgcmVzdWx0cyBhcHBlYXIgYmVuZWF0aCB0aGUgY29kZS4gCgoKTG9hZCB0aGUgcmVxdWlyZWQgbGlicmFyaWVzLiBJZiB5b3UgZG9uJ3QgaGF2ZSB0aGVtIGluc3RhbGxlZCwgcGxlYXNlIGRvIGJ5IHJ1bm5pbmcgaW5zdGFsbC5wYWNrYWdlcygpCgpgYGB7cn0KbGlicmFyeShwbG90bHkpCmxpYnJhcnkoc3RyaW5ncikKbGlicmFyeShyZXNoYXBlMikKbGlicmFyeShkcGx5cikKbGlicmFyeShyZWFkcikKCmBgYAoKCkxvYWQgdGhlIE5NUiBiaW5uZWQgY3N2LiBKdXN0IGFkYXB0IHRoZSBwYXRoIHRvIGxvY2F0aW9uIG9mIHlvdXIgZmlsZS4gWW91IGNhbiB1c2UgYXV0b2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